package com.zeroone.star.ws.comp;

import com.zeroone.star.project.dto.notify.SampleNotifyDTO;
import com.zeroone.star.ws.service.ChatServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Description
 * @Author lyx
 * @since 2024/11/8 22:36
 */
@Slf4j
@Component
public class RmRev {
    @Resource
    ChatServer server;

    @StreamListener(Sink.INPUT)
    public void receive(SampleNotifyDTO msg) {
        log.info(msg.toString());
        server.sendMessage(msg.getClientId(), msg);
    }
}
